package com.lhm;

public class demo {
  /*  //懒汉式
    private  static demo instance;
    private demo(){}
    public static synchronized demo getInstance(){
        if (instance == null){
            instance = new demo();
        }
        return instance;
    }*/

  //饿汉式
  private  static demo instance = new demo();
    private demo(){}
    public static synchronized demo getInstance(){
        return instance;
    }
}
